package cn.tedu.service.impl;

import java.util.List;
import cn.tedu.dao.ProjectCaseDao;
import cn.tedu.entity.ProjectCase;
import cn.tedu.service.ProjectCaseService;

public class ProjectCaseServiceImpl implements ProjectCaseService{

	ProjectCaseDao pdao = new ProjectCaseDao();
	public List<ProjectCase> caseList() {
		return pdao.caseList();
	}

	public List<ProjectCase> softList() {
		return pdao.softList();
	}

	public List<ProjectCase> proList() {
		return pdao.proList();
	}

	/*
	 * (non-Javadoc)
	 * @see cn.tedu.service.ProjectCaseService#caseList()
	 
	public List<ProjectCase> caseList() {
		List<ProjectCase> projectCaseList = new ArrayList<ProjectCase>();
		Connection conn = null;
		try {
			conn = DBUtil.getConnection();
			String sql = "select * from projectcase  LIMIT 0,4";
			PreparedStatement ps =  conn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				ProjectCase pc = new ProjectCase();
				pc.setId(rs.getInt(1));
				pc.setIndustry(rs.getString(2));
				pc.setImgURL(rs.getString(3));
				pc.setIntroduce(rs.getString(4));
				pc.setDetails(rs.getString(5));
				projectCaseList.add(pc);
			}
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return projectCaseList;
	}

	
	 * (non-Javadoc)
	 * @see cn.tedu.service.ProjectCaseService#softList()
	 
	public List<ProjectCase> softList() {
		List<ProjectCase> softList = new ArrayList<ProjectCase>();
		Connection conn = null;
		try {
			conn = DBUtil.getConnection();
			String sql = "select * from projectcase  LIMIT 4,6";
			PreparedStatement ps =  conn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				ProjectCase pc = new ProjectCase();
				pc.setId(rs.getInt(1));
				pc.setIndustry(rs.getString(2));
				pc.setImgURL(rs.getString(3));
				pc.setIntroduce(rs.getString(4));
				pc.setDetails(rs.getString(5));
				softList.add(pc);
			}
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return softList;
	}

	
	 * (non-Javadoc)
	 * @see cn.tedu.service.ProjectCaseService#proList()
	 
	public List<ProjectCase> proList() {
		List<ProjectCase> proList = new ArrayList<ProjectCase>();
		Connection conn = null;
		try {
			conn = DBUtil.getConnection();
			String sql = "select * from projectcase  where id=11";
			PreparedStatement ps =  conn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				ProjectCase pc = new ProjectCase();
				pc.setId(rs.getInt(1));
				pc.setIndustry(rs.getString(2));
				pc.setImgURL(rs.getString(3));
				pc.setIntroduce(rs.getString(4));
				pc.setDetails(rs.getString(5));
				proList.add(pc);
			}
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return proList;
	}*/
}
